package com.API.dal.entities;

// Generated 03.06.2013 4:15:36 by Hibernate Tools 4.0.0

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * Works generated by hbm2java
 */
@Entity
@Table(name = "WORKS", schema = "PUBLIC", catalog = "PUBLIC", uniqueConstraints = @UniqueConstraint(columnNames = "NAME"))
public class Works implements java.io.Serializable {

	private Integer id;
	private WorkType workType;
	private String name;
	private int completeness;
	private String description;
	private Set<WorksObjects> worksObjectses = new HashSet<WorksObjects>(0);

	public Works() {
	}

	public Works(WorkType workType, String name, int completeness) {
		this.workType = workType;
		this.name = name;
		this.completeness = completeness;
	}

	public Works(WorkType workType, String name, int completeness,
			String description, Set<WorksObjects> worksObjectses) {
		this.workType = workType;
		this.name = name;
		this.completeness = completeness;
		this.description = description;
		this.worksObjectses = worksObjectses;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "ID", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "TYPE_ID", nullable = false)
	public WorkType getWorkType() {
		return this.workType;
	}

	public void setWorkType(WorkType workType) {
		this.workType = workType;
	}

	@Column(name = "NAME", unique = true, nullable = false, length = 64)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "COMPLETENESS", nullable = false)
	public int getCompleteness() {
		return this.completeness;
	}

	public void setCompleteness(int completeness) {
		this.completeness = completeness;
	}

	@Column(name = "DESCRIPTION", length = 512)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "works")
	public Set<WorksObjects> getWorksObjectses() {
		return this.worksObjectses;
	}

	public void setWorksObjectses(Set<WorksObjects> worksObjectses) {
		this.worksObjectses = worksObjectses;
	}

}
